package com.googlecode.framework.web.struts2.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * 基于struts2的异常监听拦截器
 * 
 * @author xiayg
 *
 */
public class ExceptionListenerInterceptor extends AbstractInterceptor {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 6255301723756959903L;
    
    protected ExceptionListener exceptionListener;

    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        
        try {
            return invocation.invoke();
        } catch (Exception e) {
            exceptionListener.processExceptionEvent(new ExceptionEvent());
            throw e;
        }
    }

}
